package com.vhall.component.framework.common.exception;

public class BusinessException extends RuntimeException {

    private static final long serialVersionUID = 5468122937751046392L;

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(ErrorCode err) {
        super(err.getMsg());
        this.code = err.getCode();
        this.msg = err.getMsg();
        this.key = err.getKey();
    }

    public BusinessException(Integer code, String message, String key) {
        super(message);
        this.code = code;
        this.msg = message;
        this.key = key;
    }

    public BusinessException(Integer code, String message, String key, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.msg = message;
        this.key = key;
    }

    /**
     * 业务定义的异常错误码
     */
    private Integer code;

    private String msg;

    /**
     * 语言包key
     */
    private String key;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

}